//
//  WKAboutWeKeTangController.m
//  WeKeTang
//
//  Created by ichina on 2017/9/14.
//  Copyright © 2017年 Dezhi Tiancheng Education Technology (Beijing) Co. Ltd. All rights reserved.
//

#import "WKAboutWeKeTangController.h"
#import "UILabel+Addtiob.h"

@interface WKAboutWeKeTangController ()

@property (weak, nonatomic) IBOutlet UILabel *contenLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomCons;

@end

@implementation WKAboutWeKeTangController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navItem.title = @"关于微课堂";
    
    [self setupUI];
    
}
- (void)setupUI{
    
    self.navgationBar.barTintColor = RGBColor(40, 188, 203);
    
    self.statusbar.backgroundColor = RGBColor(40, 188, 203);
    
    [self middleTitleColor:[UIColor whiteColor]];
    
    self.view.backgroundColor = RGBColor(245, 245, 245);
    
    [self setLeftButtonWithImage:@"icon_return_white" highlightedImage:@"icon_return_white" target:self action:@selector(backAction)];
    
    [self.contenLabel alignTop];

    self.contenLabel.textColor = [UIColor colorWithHexString:@"666666"];
    if (iPhone5 || iPhone4) {
        [self setLabelSpace:self.contenLabel withValue:self.contenLabel.text withFont:[UIFont systemFontOfSize:12]];
    }else{
        [self setLabelSpace:self.contenLabel withValue:self.contenLabel.text withFont:[UIFont systemFontOfSize:14]];
        
    }
    
}
-(void)setLabelSpace:(UILabel*)label withValue:(NSString*)str withFont:(UIFont*)font {
    NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
    paraStyle.lineBreakMode = NSLineBreakByCharWrapping;
    paraStyle.alignment = NSTextAlignmentLeft;
    
    if (iPhone5 || iPhone4) {
        paraStyle.hyphenationFactor = 0.5;
        paraStyle.lineSpacing = 2; //设置行间距
    }else{
         paraStyle.hyphenationFactor = 1.0;
        paraStyle.lineSpacing = 5; //设置行间距
    }
    paraStyle.firstLineHeadIndent = 0.0;
    paraStyle.paragraphSpacingBefore = 0.0;
    paraStyle.headIndent = 0;
    paraStyle.tailIndent = 0;
    //设置字间距 NSKernAttributeName:@1.5f
    NSDictionary *dic = @{NSFontAttributeName:font, NSParagraphStyleAttributeName:paraStyle, NSKernAttributeName:@1.0f
                          };
    NSAttributedString *attributeStr = [[NSAttributedString alloc] initWithString:str attributes:dic];
    label.attributedText = attributeStr;
}
- (void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    
    if (iPhone5 || iPhone4) {
        self.bottomCons.constant = 110;
    }
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
